﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Social.Core.Contracts;

namespace Facebook.Contracts
{
    /// <summary>
    /// The IFaceboolService especify the contract that a FacebookService implementation must expose
    /// </summary>
    public interface IFacebookService
    {

        /// <summary>
        /// Gets the Channel being used in the implementation
        /// </summary>
         IFacebookChannel Channel { get; }

        /// <summary>
        /// Gets the deserializer being used on the implementation
        /// </summary>
         IDeserializer Deserializer { get; }

        /// <summary>
        /// Instead of access to facebook via funcionalities you can build the url on your own way and make the 
        /// request. This method  is useful when the facebook returns the urls of any object
        /// and you want to access it directly, eg: pagination
        /// </summary>
        /// <param name="pageurl">page url</param>
        /// <returns>object with the result</returns>
        dynamic GetPage(string pageurl);

       /// <summary>
       /// Selects a Graph object from the facebook ghraph API 
       /// </summary>
            /// <param name="graphId">ID</param>
            /// <param name="connectionType">CONNECTION_TYPE</param>
       /// <param name="fields">fields to retorn in the response</param>
        /// <returns>object with the result</returns>
        dynamic Select(string graphId,ConnectionType? connectionType,  string[] fields);
        
        /// <summary>
       ///   Returns an array of connections to witch the graphid is connected to
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="graphId"></param>
        /// <returns>object with the result</returns>
        dynamic GetType(string graphId);

        /// <summary>
        /// Gets the url to the profile picture from graph id object
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="graphId"></param>
        /// <returns>object with the result</returns>
        string GetPicture(string graphId);

        /// <summary>
        /// Search on the facebook graph for the query expression
        /// If the search is limited to a certain graphid that value must be diferent than null
        /// </summary>
        /// <param name="query">text to search for</param>
        /// <param name="objectType"> object graphid property type to search for. See  <typeparamref name="Facebook.SearchType"/></param>
        /// <param name="searchTypeArgs">Search parameters , e.g: pagination </param>
        /// <returns>object with the result</returns>
        dynamic Search(string query, SearchType? searchtype, IDictionary<string, string> searchTypeArgs);

        /// <summary>
        /// Submit a publishType information to the graphId object with the arguments nedeed 
        /// post on publishType object of graphid. ex : publish  a comment on a post
        /// </summary>
        /// <param name="graphId">graphid to post to</param>
        /// <param name="publishType">object type to post to</param>
        /// <param name="arguments">specific <typeparamref name="Facebook.PublishType"/> Arguments </param>
        /// <returns>object with the result</returns>
        dynamic Publish(string graphId, PublishType publishType, IDictionary<string, string> arguments);

        /// <summary>
        /// Delete a graphid object 
        /// </summary>
        /// <param name="graphId"></param>
        /// <param name="arguments"></param>
        /// <returns>object with the result</returns>
        dynamic Delete(string graphId);

        /// <summary>
        /// Query Facebook using FQL Language
        /// </summary>
        /// <param name="query">query to search for</param>
        /// <param name="format">response format</param>
        /// <returns>object with the result</returns>
        dynamic QueryGraph(string query, string format);

       
        /// <summary>
        /// Get all the analytics data related to this application
        /// </summary>
        /// <param name="metric">metric to search for. see: http://developers.facebook.com/docs/reference/fql/insights/ </param>
        /// <param name="since">Start  time to retrieve data</param>
        /// <param name="until">End time until retrieve data</param>
        /// <returns>object with the result</returns>
        dynamic GetAnalytics(string metric, string since, string until);

    }
}
